package com.example.module_car.adapter

import android.icu.text.Transliterator.Position
import android.widget.ImageView
import android.widget.LinearLayout
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.module_car.R
import com.yuwei.http.entity.AddPaymentsZFEntity

class AddPaymentsZFAdapter:BaseQuickAdapter<AddPaymentsZFEntity,BaseViewHolder>(R.layout.add_zf_item) {
    private var position = 0
    fun setPosition(position: Int){
        this.position = position
    }
    override fun convert(holder: BaseViewHolder, item: AddPaymentsZFEntity) {
        val imageView = holder.getView<ImageView>(R.id.add_payments_image)
        if (position == holder.adapterPosition){
            Glide.with(context).load(item.imageView).into(imageView)
            holder.setText(R.id.add_payments_text,item.textView)
            holder.setBackgroundResource(R.id.ll,R.drawable.add_zf_bg2)
        }else{
            holder.setBackgroundResource(R.id.ll,R.drawable.add_zf_bg1)
            Glide.with(context).load(item.imageView).into(imageView)
            holder.setText(R.id.add_payments_text,item.textView)
        }


    }
}